import babel from "@babel/core";
const sourceCode = `<div id="root">hello world</div>`;

const result = babel.transform(sourceCode, {
  // 经典模式
  plugins: [["@babel/plugin-transform-react-jsx", { runtime: "classic" }]],
});

// React.createElement(
//   "div",
//   {
//     id: "root",
//   },
//   "hello world"
// );

console.log(result.code);
